PS
Section: User Commands (1)
Updated: August 23, 1989
Index
Return to Main Contents
NAME
ps - process status
SYNOPSIS
ps
[
aceglnstuvwxU#
]
DESCRIPTION
Ps
prints information about processes.
Normally, only your processes are candidates to be printed by
ps;
specifying
a
causes other users' processes to be candidates to be printed;
specifying
x
includes processes without control terminals in the candidate pool.
All output formats include, for each process, the process id PID,
control terminal of the process TT, cpu time used by the process TIME
(this includes both user and system time), the state STAT of the process,
and an indication of the COMMAND which is running.
The state is given by a sequence of three letters, e.g. ``RWN''.
The first letter indicates the runnability of the process:
R for runnable processes,
U for uninterruptible processes,
S for those sleeping for less than about 20 seconds,
I for idle (sleeping longer than about 20 seconds),
T for stopped processes,
H for halted processes,
P for processes in page wait, and
D for those in disk (or other short term) waits,
processes.
The second letter indicates whether a process is swapped out,
showing W if it is, or a blank if it is loaded (in-core);
a process which has specified a soft limit on memory requirements
and which is exceeding that limit shows >; such a process is (necessarily)
not swapped.
The third letter indicates whether a process is running with altered
CPU scheduling priority (nice); if the process priority is reduced,
an N is shown, if the process priority has been artificially raised then
a `<' is shown; processes running without special treatment have just a
blank.
Here are the options:
- a
-
asks for information about all processes with terminals (ordinarily
only one's own processes are displayed).
- c
-
prints the command name, as stored internally in the system for purposes
of accounting, rather than the command arguments, which are kept
in the process' address space. This is more reliable, if less informative,
since the process is free to destroy the latter information.
- e
-
asks for the environment to be printed as well as the arguments to the command.
- g
-
asks for all processes.
Without this option,
ps
only prints ``interesting'' processes.
Processes are deemed to be uninteresting if they are process group leaders.
This normally eliminates top-level command interpreters and processes
waiting for users to login on free terminals.
- l
-
asks for a long listing, with fields PPID, CP, PRI, NI, ADDR, VSIZE, RSIZE and
WCHAN as described below.
- m
-
prints out the threads corresponding to each task.
- n
-
asks for numerical output.
In a long listing, the WCHAN field is printed numerically rather than
symbolically, or, in a user listing, the USER field is replaced by a
UID field.
- s
-
adds the size SSIZ of the kernel stack of each process (for use by system
maintainers) to the basic output format.
- tx
-
restricts output to processes whose controlling tty is x
(which should be specified as printed by
ps,
e.g.
t3
for tty3,
co
for console,
da
for ttyda,
?
for processes with no tty, and
' a' or ' b'
for ttya and ttyb respectively.
This option must be the last one given.
- u
-
A user oriented output is produced.
This includes fields USER, %CPU, NICE, VSIZE, and RSIZE as described below.
- v
-
A version of the output containing virtual memory statistics is output.
This includes fields RE, SL, PAGEIN, VSIZE, RSIZE, LIM, TSIZ, TRS, %CPU
and %MEM, described below. Because the NeXT computer is a Mach system (which
doesn't necessarily record the same information as a UNIX 4.3BSD system)
several of these fields will always be 0.
- w
-
Use a wide output format (132 columns rather than 80); if repeated,
e.g. ww, use arbitrarily wide output.
This information is used to decide how much of long commands to print.
- x
-
asks even about processes with no terminal.
- U
-
is a flag retained for backwards compatibility. This flag does nothing
on the NeXT system.
- #
-
A process number may be given,
(indicated here by #),
in which case the output
is restricted to that process.
This option must also be last.
A second argument is taken
to be the file containing the system's
namelist. Otherwise, /mach is used.
Fields which are not common to all output formats:
- USER
-
name of the owner of the process
- %CPU
-
cpu utilization of the process; this is a decaying average over up to
a minute of previous (real) time. Since the time base over which this
is computed varies (since processes may be very young) it is possible
for the sum of all %CPU fields to exceed 100%.
- NICE
-
(or NI) process scheduling increment (see
setpriority(2))
- VSIZE
-
virtual size of the process (in bytes)
- RSIZE
-
real memory (resident set) size of the process (in bytes)
- LIM
-
soft limit on memory used, specified via a call to
setrlimit(2);
if no limit has been specified then shown as xx
- TSIZ
-
size of text (shared program) image
- TRS
-
size of resident (real memory) set of text
- %MEM
-
percentage of real memory used by this process.
- RE
-
residency time of the process (seconds in core)
- SL
-
sleep time of the process (seconds blocked)
- PAGEIN
-
number of disk i/o's resulting from references by the process
to pages not loaded in core.
- UID
-
numerical user-id of process owner
- PPID
-
numerical id of parent of process
- CP
-
short-term cpu utilization factor (used in scheduling)
- PRI
-
process priority (non-positive when in non-interruptible wait)
- ADDR
-
swap address of the process
- WCHAN
-
event on which process is waiting (an address in the system).
A symbol is chosen that classifies the address, unless numerical
output is requested (see the
n
flag).
In this case, the initial part of the address is
trimmed off and is printed hexadecimally, e.g., 0x80004000 prints as 4000.
- F
-
flags associated with process as in
<sys/proc.h>:
SLOAD 00000001 in core
SSYS 00000002 swapper or pager process
SLOCK 00000004 process being swapped out
SSWAP 00000008 save area flag
STRC 00000010 process is being traced
SWTED 00000020 another tracing flag
SULOCK 00000040 user settable lock in core
SPAGE 00000080 process in page wait state
SKEEP 00000100 another flag to prevent swap out
SOMASK 00000200 restore old mask after taking signal
SWEXIT 00000400 working on exiting
SPHYSIO 00000800 doing physical i/o
SVFORK 00001000 process resulted from vfork()
SVFDONE 00002000 another vfork flag
SNOVM 00004000 no vm, parent in a vfork()
SPAGI 00008000 init data space on demand from inode
SSEQL 00010000 user warned of sequential vm behavior
SUANOM 00020000 user warned of anomalous vm behavior
STIMO 00040000 timing out during sleep
SACTIVE 00080000 process is executing
SOUSIG 00100000 using old signal mechanism
SOWEUPC 00200000 owe process and addupc() call at next ast
SSEL 00400000 selecting; wakeup/waiting danger
SLOGIN 00800000 a login process (legitimate child of init)
SLKDONE 20000000 record-locking has been done
A process that has exited and has a parent that has not
yet waited for the process is marked <defunct>; a process
which is blocked trying to exit is marked <exiting>;
Ps
makes an educated guess as to the file name
and arguments given when the process was created
by examining memory or the swap area.
The method is inherently somewhat unreliable and in any event
a process is entitled to destroy this information,
so the names cannot be counted on too much.
FILES
/mach system namelist
/dev searched to find swap device and tty names
SEE ALSO
kill(1), w(1)
BUGS
Things can change while
ps
is running; the picture it gives is only a close
approximation to reality.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- FILES
-
- SEE ALSO
-
- BUGS
-
This document was created by
man2html,
using the manual pages.
Time: 17:18:46 GMT, March 25, 2025